package com.ants.platform.core.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by liushun on 2016/8/10.
 */
public class OnlineUtil {

    private static Map map = new HashMap<>();

    //统计总在线人数
    public static int getCount() {
        return map.size();
    }

    //添加用户信息
    public static void add(String sssionId, Object obj) {
        map.put(sssionId, obj);
    }

    //删除用户信息
    public static void remove(String sssionId) {
        map.remove(sssionId);
    }

    //修改用户信息
    public static void update(String sssionId, Object obj) {
        if (map.containsKey(sssionId))
            map.put(sssionId, obj);
    }

    //查询用户信息
    public static Object query(String sssionId) {
        return map.get(sssionId);
    }
}
